<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    protected $table = 'product';

    public function factory()
    {
        return $this->belongsTo('App\Type', 'factory_id', 'id');
    }

    public function model()
    {
        return $this->belongsTo('App\Type', 'model_id', 'id');
    }

    public function getFileNamesAttribute($value)
    {
        return explode(',', $value);
    }

    public function getFilesAttribute($value)
    {
        return explode(',', $value);
    }

}
